package com.clf.springBoot.modules.account.controller;

import com.clf.springBoot.modules.account.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * @Author: chenglongfei
 * @date: 2022/7/7
 * @Description AccountController
 */
@Controller
public class AccountController {

    /**
     * 127.0.0.1/login ---- get
     */
    @Autowired
    private UserService userService;

    /**
     * 127.0.0.1/login ---- get
     */
    @GetMapping("/login")
    public String loginPage() {
        return "account/login";
    }

    /**
     * 127.0.0.1/logout ---- get
     */
    @GetMapping("/logout")
    public String logout() {
        userService.logout();
        return "redirect:/login";
    }

    /**
     * 127.0.0.1/account/users ---- get
     */
    @GetMapping("/account/users")
    public String usersPage() {
        return "index";
    }
}
